-- Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
--
-- this file licensed under the Mulan PSL v2.
-- You can use this software according to the terms and conditions of the Mulan PSL v2.
-- You may obtain a copy of Mulan PSL v2 at: http://license.coscl.org.cn/MulanPSL2
--
-- THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
-- PURPOSE.
-- See the Mulan PSL v2 for more details.
--
-- Author: auto generate
-- Create: 2025-8-19
-- Description: DO NOT EDIT; Code generated by "message.lua.mako"
local validate = require 'mc.validate'
local utils = require 'mc.utils'
local mdb = require 'mc.mdb'

local Community = {}

---@class Community.WelcomeMessage
---@field WelcomeMessage string
local TWelcomeMessage = {}
TWelcomeMessage.__index = TWelcomeMessage
TWelcomeMessage.group = {}

local function TWelcomeMessage_from_obj(obj)
    return setmetatable(obj, TWelcomeMessage)
end

function TWelcomeMessage.new(WelcomeMessage)
    return TWelcomeMessage_from_obj({WelcomeMessage = WelcomeMessage})
end
---@param obj Community.WelcomeMessage
function TWelcomeMessage:init_from_obj(obj)
    self.WelcomeMessage = obj.WelcomeMessage
end

function TWelcomeMessage:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TWelcomeMessage.group)
end

TWelcomeMessage.from_obj = TWelcomeMessage_from_obj

TWelcomeMessage.proto_property = {'WelcomeMessage'}

TWelcomeMessage.default = {''}

TWelcomeMessage.struct = {{name = 'WelcomeMessage', is_array = false, struct = nil}}

function TWelcomeMessage:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'WelcomeMessage', self.WelcomeMessage, 'string', false, errs, need_convert)

    TWelcomeMessage:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TWelcomeMessage.proto_property, errs, need_convert)
    return self
end

function TWelcomeMessage:unpack(_)
    return self.WelcomeMessage
end

Community.WelcomeMessage = TWelcomeMessage

---@class Community.GetRepoURLRsp
---@field OutData string
local TGetRepoURLRsp = {}
TGetRepoURLRsp.__index = TGetRepoURLRsp
TGetRepoURLRsp.group = {}

local function TGetRepoURLRsp_from_obj(obj)
    return setmetatable(obj, TGetRepoURLRsp)
end

function TGetRepoURLRsp.new(OutData)
    return TGetRepoURLRsp_from_obj({OutData = OutData})
end
---@param obj Community.GetRepoURLRsp
function TGetRepoURLRsp:init_from_obj(obj)
    self.OutData = obj.OutData
end

function TGetRepoURLRsp:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TGetRepoURLRsp.group)
end

TGetRepoURLRsp.from_obj = TGetRepoURLRsp_from_obj

TGetRepoURLRsp.proto_property = {'OutData'}

TGetRepoURLRsp.default = {''}

TGetRepoURLRsp.struct = {{name = 'OutData', is_array = false, struct = nil}}

function TGetRepoURLRsp:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'OutData', self.OutData, 'string', false, errs, need_convert)

    TGetRepoURLRsp:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TGetRepoURLRsp.proto_property, errs, need_convert)
    return self
end

function TGetRepoURLRsp:unpack(_)
    return self.OutData
end

Community.GetRepoURLRsp = TGetRepoURLRsp

---@class Community.GetRepoURLReq
---@field SercretNumber integer
local TGetRepoURLReq = {}
TGetRepoURLReq.__index = TGetRepoURLReq
TGetRepoURLReq.group = {}

local function TGetRepoURLReq_from_obj(obj)
    return setmetatable(obj, TGetRepoURLReq)
end

function TGetRepoURLReq.new(SercretNumber)
    return TGetRepoURLReq_from_obj({SercretNumber = SercretNumber})
end
---@param obj Community.GetRepoURLReq
function TGetRepoURLReq:init_from_obj(obj)
    self.SercretNumber = obj.SercretNumber
end

function TGetRepoURLReq:remove_error_props(errs, obj)
    utils.remove_obj_error_property(obj, errs, TGetRepoURLReq.group)
end

TGetRepoURLReq.from_obj = TGetRepoURLReq_from_obj

TGetRepoURLReq.proto_property = {'SercretNumber'}

TGetRepoURLReq.default = {0}

TGetRepoURLReq.struct = {{name = 'SercretNumber', is_array = false, struct = nil}}

function TGetRepoURLReq:validate(prefix, errs, need_convert)
    prefix = prefix or ''

    validate.Optional(prefix .. 'SercretNumber', self.SercretNumber, 'uint32', false, errs, need_convert)

    TGetRepoURLReq:remove_error_props(errs, self)
    validate.CheckUnknowProperty(self, TGetRepoURLReq.proto_property, errs, need_convert)
    return self
end

function TGetRepoURLReq:unpack(_)
    return self.SercretNumber
end

Community.GetRepoURLReq = TGetRepoURLReq

Community.interface = mdb.register_interface('bmc.demo.OpenUBMC.Community',
    {WelcomeMessage = {'s', nil, false, nil, false}}, {GetRepoURL = {'a{ss}u', 's', TGetRepoURLReq, TGetRepoURLRsp}}, {})

return Community
